#ifndef FILEHANDLER_H
#define FILEHANDLER_H

#include <QString>
#include <QDateTime>

#include "global_defines.h"
#include "specvelosave.h"
//#include "hdf5save.h"

class FILEHANDLER
{
public:
    FILEHANDLER(SOFTWARESETTINGS settings, double *Height_values, double *freqAxis);

    void initFile();
    void initFile_noL3_noLog();
    void Create_DataFolder();
    void appendSPEC(PSD_DATA *PSD_Union, quint64 CTms, double currentMotorAngle);
    void appendVelo(double *hVelocity, double *hAngle, double *vVelocity, qint64 CTms, double currentMotorAngle);
//    void closefile();
    void append_l1_data(L1_DATA l1_data);
    void append_l2_data(L2_DATA l2_data);
    void append_l3_data_minAvg(L3_DATA l3_data);
    void append_l3_data_hourAvg(L3_DATA l3_data);
    void append_lidar_data(LidarLog_DATA lidar_data);


    QString SpecFileName;
    QString VeloFileName;
    QString Level_1_FileName;
    QString Level_2_FileName;
    QString Level_3_FileName_minAvg;
    QString Level_3_FileName_hourAvg;
    QString Lidar_FileName;
    void checkForNewDateDir();

private:
    unsigned int nRB, nFFT_half;
    double *Height_values;
    double *freqAxis;
    SOFTWARESETTINGS settings;

    void generate_L1FileName();
    void generate_L2FileName();
    void generate_L3FileName_minAvg();
    void generate_L3FileName_hourAvg();
    void generate_LidarFileName();
};

#endif // FILEHANDLER_H
